/*
* @Author: majingyu
* @Date:   2017-06-02 21:19:49
* @Last Modified by:   majingyu
* @Last Modified time: 2017-06-02 22:10:16
*/

import React, { Component }from 'react';
import { connect } from 'react-redux';
import { getOrderDetails } from 'action/orders.js';
import 'css/commontList.less';
import 'css/orderDetail.less';
 
class OrderDetail extends Component{
    constructor(props) {
        super(props);
        this.getDetail();
        console.log(this.props.orders)
    }  
    getDetail(){
        let data = {
            id: this.props.orders.ordersId
        }
        this.props.getDetail();
    }
    render(){
        return(
            <div className="content">
                <div className="order-detail-info">
                    <div className="line-info">
                        <lable className="title">发布人:</lable>
                        <div className="txt">{this.props.orders.orderDetail.user}</div>
                    </div>
                    <div className="line-info">
                        <lable className="title">发布课目:</lable>
                        <div className="txt">{this.props.orders.orderDetail.name}</div>
                    </div>
                    <div className="line-info">
                        <lable className="title">发布时间:</lable>
                        <div className="txt">{this.props.orders.orderDetail.time}</div>
                    </div>
                    <div className="line-info">
                        <lable className="title">有效期:</lable>
                        <div className="txt">{this.props.orders.orderDetail.dataLineTime}</div>
                    </div>
                    <div className="line-info">
                        <lable className="title">上课地址:</lable>
                        <div className="txt">{this.props.orders.orderDetail.addressSekected}</div>
                    </div>
                    <div className="line-info">
                        <lable className="title">预期价格:</lable>
                        <div className="txt">{this.props.orders.orderDetail.price}</div>
                    </div>
                    <div className="line-info">
                        <lable className="title">上课方式:</lable>
                        <div className="txt">{this.props.orders.orderDetail.stle}</div>
                    </div>
                    <div className="line-info">
                        <lable className="title">联系电话:</lable>
                        <div className="txt">{this.props.orders.orderDetail.mobile}</div>
                    </div>
                    <div className="line-info">
                        <lable className="title">联系地址:</lable>
                        <div className="txt">{this.props.orders.orderDetail.address}</div>
                    </div>
                </div>
            </div>
        );
    }
}
const detailData = (state) => {
    return {
        orders: state.orders
    }
}
let dispatchHandle = (dispatch, getState) => {
    return {
        getDetail(data){
            dispatch(getOrderDetails(data));
        }
    }  
}
let visibileOrderDetail= connect(detailData,dispatchHandle)(OrderDetail);


export default visibileOrderDetail;